﻿namespace DataValidation.FluentValidation
{
    public class Response<T>
    {
        public T Data { get; set; }

        public string Message { get; set; }

        public int Code { get; set; }
    }


    public static class ResultBuilder
    {
        public static Response<T> FailResult<T>(T data, string failReason = "请求失败", int code = 99)
        {
            return new Response<T>
            {
                Code = code,
                Message = failReason,
                Data = data
            };
        }

        public static Response<T> SuccessResult<T>(T data, string message = "请求成功")
        {
            return new Response<T>
            {
                Code = 0,
                Message = message,
                Data = data
            };
        }
    }





}
